/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts.reports;

import net.sf.jasperreports.engine.*;
import java.util.*;
import javax.servlet.http.*;

public class PurchaseRepSUPWise extends HttpServlet implements JRDataSource {

    private static final long serialVersionUID = 1L;
    private int index = -1;
    int data = 0;
    public int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7 = 0;
    Vector v1 = new Vector();
    Vector v2 = new Vector();
    Vector v3 = new Vector();
    Vector v4 = new Vector();
    Vector v5 = new Vector();
    Vector v6 = new Vector();
    Vector v7 = new Vector();

    public PurchaseRepSUPWise(int data, Vector v1, Vector v2, Vector v3, Vector v4, Vector v5, Vector v6, Vector v7) {
        this.data = data;
        this.v1 = v1;
        this.v2 = v2;
        this.v3 = v3;
        this.v4 = v4;
        this.v5 = v5;
        this.v6 = v6;
        this.v7 = v7;
    }

    public boolean next() throws JRException {
        index++;
        return (index < data);
    }

    public Object getFieldValue(JRField field) throws JRException {

        Object value = null;

        String fieldName = field.getName();

        try {


            if ("purchase_iname".equals(fieldName)) {
                value = v1.elementAt(c1);
                c1++;
            } else if ("purchase_sname".equals(fieldName)) {
                value = v2.elementAt(c2);
                c2++;
            } else if ("purchase_qty".equals(fieldName)) {
                value = v3.elementAt(c3);
                c3++;
            } else if ("purchase_rate".equals(fieldName)) {
                value = v4.elementAt(c4);
                c4++;
            } else if ("purchase_value".equals(fieldName)) {
                value = v5.elementAt(c5);
                c5++;
            } else if ("purchase_pdate".equals(fieldName)) {
                value = v6.elementAt(c6);
                c6++;
            } else if ("items_uom".equals(fieldName)) {
                value = v7.elementAt(c7);
                c7++;
            }
        } catch (Exception p) {
        }

        return value;
    }
}
